
function upload() {
  //获取图片临时地址
  wx.chooseImage({
    count: 1,
    success: async res => {
      let tempPath = res.tempFilePaths[0]
      //上传图片到云存储，指定filePath,cloudPath
      let nowtime = new Date().getTime()
      let ext = tempPath.split(".").pop()

      let result = await wx.cloud.uploadFile({
        cloudPath: nowtime + "." + ext,
        filePath: tempPath
      }).catch(err => {
        console.log(err)
      })
      console.log(result)

    }
  })
}

export { upload }